<template>
	<view style="padding: 60rpx 30rpx;line-height: 70rpx;font-size: 30rpx;">
		<text style="margin: 30rpx 0 10rpx 0;display: block;">新密码</text>
		<view
			style="display: flex;justify-content: flex-start;align-items: center;padding: 10rpx;background-color: #f2f7fb;border-radius: 20rpx;height: 70rpx;">
			<input v-model="user.password" style="line-height: 70rpx;font-size: 30rpx;width: 70%;margin-left: 20rpx;"
				type="password" placeholder="请输入密码" />
		</view>
		<text style="line-height: 80rpx;">确认密码</text>
		<view
			style="display: flex;justify-content: flex-start;align-items: center;padding: 10rpx;background-color: #f2f7fb;border-radius: 20rpx;height: 70rpx;">
			<input v-model="password_" style="line-height: 70rpx;font-size: 30rpx;width: 70%;margin-left: 20rpx;"
				type="password" placeholder="请再次输入密码" />
		</view>
		<button @click="updatePassword" type="default"
			style="background-color: #007AFF;color: #ffffff;margin-top: 50rpx;">确认</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					password: ''
				},
				password_: '',
				a: 0
			}
		},
		onLoad: function(e) {
			this.user.id = e.id
			this.a = Number(e.a)
		},
		methods: {
			updatePassword() {
				if (this.user.password.length == 0) {
					uni.$u.toast('请输入密码')
				} else if (this.user.password != this.password_) {
					uni.$u.toast('两次密码不一致，请确认密码')
				} else {
					// 调用修改密码接口

					// 修改成功回调
					uni.navigateTo({
						url: '../login/login'
					})
				}

			}
		}
	}
</script>

<style>

</style>
